/*
 * @Date: 2022-11-29 14:38:32
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-11-29 14:41:55
 * @FilePath: \vue-admin-ts\src\hooks\usePermission\index.ts
 * @Description: usePermission
 */
import { useStore } from "@/store";

export const usePermission = (pageName: string, permission: string) => {
  const store = useStore();
  const verify = `system:${pageName}:${permission}`;
  const permissions = store.state.loginModule.permissions;
  return !!permissions.find((item) => item === verify);
};
